function redirectMobile() {
    var isMobile = /iPhone|iPad|iPod|Android|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Mobile Safari|Opera Mini/i.test(navigator.userAgent);
    var currentUrl = window.location.pathname;
    var search = window.location.search;
    console.log(window.location);
    console.log(currentUrl);
    if (isMobile) {
        let url = "";
        // 是移动设备
        if(currentUrl.indexOf(currentUrl+'/m/')===-1){
            switch (window.location.pathname){
                // 首页 start
                case '/':
                    url = '/m/index';
                    break;
                case '/depart/list':
                    url = '/m/index/depart/list';
                    break;
                case '/artist/list':
                    url = '/m/index/artist/list';
                    break;
                case '/event/list':
                    url = '/m/index/event/list';
                    break;
                case '/artwork/online':
                    url = '/m/index/artwork/online';
                    break;
                case '/index/article/list':
                    url = '/m/index/article/list';
                    break;
                case '/article':
                    url = '/m/index/article';
                    break;
                case '/online/artwork/detail':
                    url = '/m/index/online/artwork/detail';
                    break;
                // 首页 end

                // 机构 start
                case '/depart':
                    url = '/m/depart';
                    break;
                case '/depart/page':
                    url = '/m/depart/page';
                    break;
                case '/depart/artwork/detail':
                    url = '/m/depart/artwork/detail';
                    break;
                case '/depart/article/detail':
                    url = '/m/depart/article/detail';
                    break;
                // 机构 end

                // 艺术家 start
                case '/artist/page':
                url = '/m/artist/page';
                break;
                case '/artist/artwork/detail':
                    url = '/m/artist/artwork/detail';
                    break;
                case '/article/article/detail':
                    url = '/m/artist/article/detail';
                    break;
                // 艺术家 end
                // 活动展览 start
                case '/event/page':
                    url = '/m/event/page';
                    break;
                case '/event/article/detail':
                    url = '/m/event/article/detail';
                    break;
                // 活动展览 end
            }
        }

        if(url!==''){
            window.location.href = window.location.origin+url+search;
        }

        console.log(currentUrl);
        //window.location.href = 'https://www.example.com/mobile'; // 移动版URL
    }else{
        // 是移动设备
        if(currentUrl.indexOf(currentUrl+'/m')!==-1){

        }

    }
}

redirectMobile();
